package simpleFactory;

import simpleFactory.pizza.extend.CheesePizza;
import simpleFactory.pizza.extend.ChinesePizza;
import simpleFactory.pizza.extend.GreekPizza;
import simpleFactory.pizza.Pizza;

/**
 * @author : DuJiabao
 * @Date : 2021/3/1 20:09
 * @Project : design-pattern
 * @File : null.java
 * @Desc :
 */
public class SimpleFactory {
  public Pizza createPizza(String name) {
    return switch (name) {
      case "Greek" -> new GreekPizza();
      case "Cheese" -> new CheesePizza();
      case "Chinese" -> new ChinesePizza();
      default -> null;
    };
  }
}
